package servlet.listenerServlet;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "RequestAttributeServlet", value = "/requestAttr")
public class RequestAttributeServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        //request添加属性
        request.setAttribute("name","tom");
        //因为key相同，所以是修改属性
        request.setAttribute("name","jerry");
        //移除属性
        request.removeAttribute("name");

    }
}
